<?php
	$this->placeholder('page_title')->set($this->artist->name);
	$this->dojo()
	->requireModule('dijit.form.Button')
	->requireModule('dijit.layout.ContentPane')
	->requireModule('dojo.parser')
	->enable();

	$this->headScript()->appendFile(ZUPAL_BASEURL . '/modules/media/musicbrainz/scripts/artist.js');
	$this->headScript()->captureStart();
?>

dojo.addOnLoad(
	function ()
	{
		zupal.media.musicbrainz.Artist.base = '<?= ZUPAL_BASEURL ?>';
		zupal.media.musicbrainz.Artist.fetchArtist( '<?= $this->artist->gid ?>');
	}
);
<?
	$this->headScript()->captureEnd();
?>

<table>
	<thead>
	<tr>
		<td colspan="2">
			<dl>
				<dt>Artist</dt>
				<dd id="artist_info_name" dojoType="dijit.layout.ContentPane">&nbsp;</dd>
			</dl>
		</td>
	</tr>

	<tr>
		<th>Relationship</th>
		<th>Artist</th>
	</tr>
	</thead>

	<tbody id="artist_info_artist">
	</tbody>

	<tbody>
		<tr>
			<th>Group</th>
			<th>Members</th>
		</tr>
	</tbody>

	<tbody id="artist_info_groups">
	</tbody>
</table>

<br clerar="all" />

<h2>Data</h2>

<dl>
	<dt>Name</dt>
	<dd><?= $this->artist->name ?></dd>
	<dt>Type</dt>
	<dd><?= $this->artist->type() ?></dd>
<? if ($this->artist->is_person()): ?>
	<dt>Group(s)</dt>
	<dd>
	<ol>
		<? foreach($this->artist->groups() as $group): ?>
		<li><?= $group->artist->name ?> (<?= $group->type->name ?>)
		<ul>
<? foreach ($group->artist->people() as $person): ?>
			<li>
				<?= $person->artist->name ?>(<?= $person->type->name ?>)
			</li>
<? endforeach; ?>
		</ul>
		</li>
		<? endforeach; ?>
	</ol>
	</dd>
<? endif; ?>
	<dt>People</dt>
	<dd>
		<ol>
<? foreach($this->artist->people() as $person): ?>
			<li>
				<?= $person->artist->name ?>(<?= $person->type->name ?>)
			</li>
<? endforeach; ?>
		</ol>
	</dd>
</dl>

<h2>JSON</h2>

<textarea rows="30" cols="40">
<?= stripslashes($this->artist->json()) ?>
</textarea>

<pre>
<? print_r($this->artist->json_data()) ?>
</pre>
